package org.ucas.faker.web.fetcher.meta;

import org.ucas.faker.web.fetcher.op.Join;

import java.io.Serializable;

public class JoinTable extends Table implements Serializable {

  public Join join;

  public JoinTable(Join join) {
    assert join != null;
    this.join = join;
  }

  @Override
  public String sql() {
    if(join == null) return super.sql();

    String res = join.sql();

    return name == null? res : "( " + res + ") AS "+name;
  }
}
